<template>
    <div id="app">
      <router-view v-if="isRouterAlive"></router-view>
    </div>
</template>

<script>
export default {
    name: "App",
    components: {},

    //定义刷新
    provide(){
    return {
      reload: this.reload
    }
    },
    data() {
    return {
      isRouterAlive: true,
    };
    },
    cread() {},
    created() {
        // 轮询覆写flag标签, 激活页面的监听事件
        let flag = true;
        setInterval(() => {
            flag = !flag;
            sessionStorage.setItem("flag", flag);
        }, 5000);
    },
    methods:{

      //刷新事件
      reload(){
        this.isRouterAlive = false;
        this.$nextTick(function(){
          this.isRouterAlive = true;
        })
      }
    },
  mounted() {
  },

};
</script>

<style scoped lang="scss"></style>
